- Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy path519.Random Flip Matrix_test.go
52 lines (43 loc) · 1021 Bytes
/
519.Random Flip Matrix_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package leetcode
import (
"fmt"
"testing"
)
typequestion519struct {
para519
ans519
}
// para 是参数
typepara519struct {
para []string
val [][]int
}
// ans 是答案
typeans519struct {
ans [][]int
}
funcTest_Problem519(t*testing.T) {
qs:= []question519{
{
para519{[]string{"Solution", "flip", "flip", "flip", "reset", "flip"}, [][]int{{3, 1}, {}, {}, {}, {}, {}}},
ans519{[][]int{nil, {1, 0}, {2, 0}, {0, 0}, nil, {2, 0}}},
},
}
fmt.Printf("------------------------Leetcode Problem 519------------------------\n")
for_, q:=rangeqs {
_, p:=q.ans519, q.para519
sol:=Constructor(0, 0)
for_, v:=rangep.para {
ifv=="Solution" {
sol=Constructor(q.val[0][0], q.val[0][1])
fmt.Printf("【input】:%v 【output】:%v\n", v, nil)
} elseifv=="flip" {
fmt.Printf("【input】:%v 【output】:%v\n", v, sol.Flip())
} else {
sol.Reset()
fmt.Printf("【input】:%v 【output】:%v\n", v, nil)
}
}
}
fmt.Printf("\n\n\n")
}